ifeq ($(TOP_DIR),)
KERNEL_DIR := $(srctree)

EXTRA_CFLAGS += -I$(PWD)/drivers/dev_inc
EXTRA_CFLAGS += -I$(PWD)/inc/driver
EXTRA_CFLAGS += -I$(PWD)/kernel/vendor/bbox/driver/mntn/blackbox
EXTRA_CFLAGS += -I$(PWD)/kernel/vendor/bbox/include/
ccflags-y += -Wall -Werror

ifeq ($(TARGET_PRODUCT), cloud)
EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD
EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/dfm/ascd910
endif
ifeq ($(TARGET_PRODUCT), mdc)
	ifeq ($(TARGET_CHIP_ID), $(ASCEND_FLORENCE_MDC_V10))
		EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MINIV2
		EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/dfm/ascd610
	else ifeq ($(TARGET_CHIP_ID), $(ASCEND_MDC_PG2))
		EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MINIV2
		EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/dfm/ascd610
	else
		EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/dfm/ascd310
	endif
endif
ifeq ($(TARGET_PRODUCT), mini)
	ifeq ($(TARGET_CHIP_ID), $(ASCEND_FLORENCE_DC_V10))
		EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MINIV2
		EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/dfm/ascd610
	else
		EXTRA_CFLAGS += -I$(PWD)/drivers/dev_plat/dfm/ascd310
	endif
endif
obj-m   += drv_dfm.o
ifeq ($(TARGET_PRODUCT), cloud)
	drv_dfm-objs := ascd910/devdrv_dfm_cloud.o
endif
ifeq ($(TARGET_PRODUCT), mdc)
	ifeq ($(TARGET_CHIP_ID), $(ASCEND_FLORENCE_MDC_V10))
		drv_dfm-objs := ascd610/devdrv_dfm_miniv2.o
	else ifeq ($(TARGET_CHIP_ID), $(ASCEND_MDC_PG2))
		drv_dfm-objs := ascd610/devdrv_dfm_miniv2.o
	else
		drv_dfm-objs := ascd310/devdrv_dfm_mini.o
	endif
endif
ifeq ($(TARGET_PRODUCT), mini)
	ifeq ($(TARGET_CHIP_ID), $(ASCEND_FLORENCE_DC_V10))
		drv_dfm-objs := ascd610/devdrv_dfm_miniv2.o
	else
		drv_dfm-objs := ascd310/devdrv_dfm_mini.o
	endif
endif

else
EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_inc
EXTRA_CFLAGS += -I$(TOP_DIR)/inc/driver
EXTRA_CFLAGS += -I$(TOP_DIR)/kernel/vendor/bbox/driver/mntn/blackbox
EXTRA_CFLAGS += -I$(TOP_DIR)/kernel/vendor/bbox/include/

ccflags-y += -Wall -Werror

ifneq ($(findstring $(PRODUCT),  ascend910 ascend920 ascend920esl),)
EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_CLOUD
EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_plat/dfm/ascd910
obj-m   += drv_dfm.o
drv_dfm-objs := ascd910/devdrv_dfm_cloud.o

else ifneq ($(findstring $(PRODUCT),  ascend610 ascend615 ascend710),)
   EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_plat/dfm/ascd610
   EXTRA_CFLAGS += -DCFG_SOC_PLATFORM_MINIV2
   obj-m   += drv_dfm.o
   drv_dfm-objs := ascd610/devdrv_dfm_miniv2.o
else
   EXTRA_CFLAGS += -I$(TOP_DIR)/drivers/dev_plat/dfm/ascd310
   obj-m   += drv_dfm.o
   drv_dfm-objs := ascd310/devdrv_dfm_mini.o
endif
endif

